<template>
  <view class="sett">
      <label class="radio">
        <radio @click="changeAll" color="#c00000" :checked="isAllSelect"/><text>全选</text>
      </label>
      <view class="price">合计:<text>{{getPrice}}.00</text> </view>
      <view class="sett_button" @click="settle">结算({{selectNum}})</view>
  </view>
</template>

<script>
  import {mapGetters,mapMutations,mapState} from "vuex"
  export default {
    name:"MySettlement",
    data() {
      return {
        All:false
      };
    },
    methods:{
      ...mapMutations('cartStore',['changeAllSelect']),
      changeAll(){
        this.changeAllSelect(!this.isAllSelect)
      },
      settle(){
        if(this.token==''){
          return uni.$showMsg("您还未登录！")
        }
        if(!this.address.userName) {
          return uni.$showMsg('您还没有选择收获地址！')
        }
        
        if(this.selectNum<=0) {
          return uni.$showMsg("您还没有选择商品！")
        }
        uni.navigateTo({
          url:"/subpkg/SettleSuccess/SettleSuccess"
        })
      }
    },
    computed:{
      ...mapGetters('cartStore',['selectNum','isAllSelect','getPrice']),
      ...mapState('cartStore',['address']),
      ...mapState('userStore',['token'])
    }
  }
</script>

<style lang="scss">
.sett{
  height: 50px;
  position: fixed;
  bottom: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 5px;
  font-size: 14px;
  .radio{
    display: flex;
    align-items: center;
  }
  .price{
    text{
      font-weight: bold;
      color: #c00000;
      font-size: 16px;
    }
  }
  .sett_button{
    width: 100px;
    height: 100%;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #c00000;
  }
}
</style>